<?php echo $this->headScript()
	->appendFile($this->js('plugins/jquery.form.js'))
	->appendFile($this->js('plugins/jquery.blockUI.js'))
	->captureStart()?>
	$(document).ready(function(){
		$(".like_button").click(function(){
			$("#detail_setup").hide();
			var ss = $(this).attr('val');
			var url = "<?php echo $this->baseScript ?>/getyear/year/<?php echo $this->year ?>/semester/<?php echo $this->semester ?>/id/"+ss;
			$.getJSON(url, function(json){
				var y_name = $("#s-"+ss).text();
				$("#s_year").html(y_name);
				var len = json.length;
				var ff = $("#setyearForm table tbody");
				ff.empty();
				for(var i=0;i < len; i++){
					var tt = '<tr><td align="center">'+y_name+' <input type="text" name="sn['+json[i]['sn']+']" value="'+json[i]['chinese_name']+'" size="4"> 班</td></tr>';
					ff.append(tt);
				}
  				//alert("JSON Data: " + json[1]['chinese_name']);
			});

			$("#detail_setup").show();

		});

		var options = {
		  beforeSubmit: function(){
	       $.blockUI({
           message: '<?php echo $this->translate('class name setting ..')?>',
           css: { 'font-size': '18px' , 'color': '#f00' }
            });
          setTimeout($.unblockUI, 1500);
		  },
          success:  function(data){
        	$("#s_year").hide().fadeIn('slow');

        }
    };

    // bind form using 'ajaxForm'
    $('#setyearForm').ajaxForm(options);


    var options = {
	    beforeSubmit: function(){
	     $.blockUI({
	       message: '<?php echo $this->translate('class name setting ..')?>',

	        });
         setTimeout($.unblockUI, 1500);
	    },
        success: function(data){
        $('#main_body').unblock();
        }

	}
//	$('#menu_form').ajaxForm(options);

	$("#year_semester").change(function(){
		$("#menu_form").submit();
	});

	});
<?php echo $this->headScript()->captureEnd()?>
<?php echo $this->headStyle()->captureStart()?>
#main_body ,#detail_setup{float:left}
#main_body table,#detail_setup table {background:#ccc;margin:5px;}
#main_body tr ,#detail_setup tr{background:#fff}
#main_body td ,#detail_setup td{padding:3px;}
#detail_setup {margin-left:10px}
<?php echo $this->headStyle()->captureEnd()?>

<div id="main_body" >
<form name="menu_form" id="menu_form" method="post" action="<?php echo $this->baseScript?>/set">
<table>
<tr><th colspan="4"><?php echo $this->translate('setup semester')?>：
<select name="year_semester" id="year_semester">
<?php echo  $this->YearSemesterOptions($this->year_semester)?>
</select>
</th></tr>
<tr><th><?php echo $this->translate('grade')?></th><th><?php echo $this->translate('class number')?></th>
<th><?php echo $this->translate('name type')?></th><th><?php echo $this->translate('class list')?></th></tr>

<?php foreach($this->year_name as $id=>$val): ?>
<tr style="text-align:center">
<td id="s-<?php echo $id ?>"><?php echo $val ?></td>
<td><input name="c_num[<?php echo $id ?>]" type="text" size="4" style="text-align:right" value="<?php echo @$this->num_data[$id]?>"></td>
<td>
	<select name="c_name_kind[<?php echo $id ?>]">
	<?php foreach ($this->classNameKind as $k=>$v): ?>
	<option value="<?php echo $k ?>" <?php if ($k==@$this->name_arr[$id]): ?>selected<?php endif ?> ><?php echo $v ?></option>
	<?php endforeach ?>
	</select>
</td>
<td><span class="like_button" val="<?php echo $id ?>"><a href="#"><?php echo $val ?><?php echo $this->translate('class setup')?></a></span></td>
</tr>
<?php endforeach ?>

</table>
<br />

<input type="submit" name="act" value="<?php echo $this->translate('setup')?>" />
</form>
</div>

<div id="detail_setup"  style="display:none">
<form action="<?php echo $this->baseScript ?>/setyear" method="post" id="setyearForm">
<table>
<thead>
<tr><th><span id="s_year" style="color:red"></span> <?php echo $this->translate('edit class name')?> </th></tr>
</thead>
<tbody>

</tbody>
</table>
<br />
<input type="submit" value="<?php echo $this->translate('change class name')?>" /> <span class="loading" style="display:none"></span>
</form>
</div>
<div style="clear:both;"></div>
<br />


